package com.estasenposse.tdam.services;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class ConectivityStatus {

	private Boolean internetConection;
	private Context context;

	public ConectivityStatus(Context context) {
		this.context = context;
	}

	//Return True if the mobile is connected. False if not.
	public Boolean isConected() {
		internetConection = false;
		ConnectivityManager connectivityManager = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
		if (networkInfo != null && networkInfo.isConnected()) {
			internetConection = true;
		}
		return internetConection;
		
	}

}
